import { TokenRequestData } from '@/types'

export interface queryBatteryInfoRequestData extends TokenRequestData {
  produceId: string
  type?: string
}
/**
 * 充电 MOS 开 0：充电 MOS 关
 */
export type chargeSwitchType = '0' | '1'
/**
 * 放电 MOS 开 0：放电 MOS 关
 */
export type dischargeSwitchType = '0' | '1'
/**
 * 告警 0 正常 1告警
 */
export type AlarmType = '0 ' | '1'
export interface batteryHeadType {
  batteryNumber: string // 电池编号
  soc: string // 电量
  soh: string
  chargeSwitch: chargeSwitchType
  dischargeSwitch: dischargeSwitchType
  voltage: string //电压
  electricCurrent: string //电流值
  power: string //当前功率
  equilibriumState: string //均衡状态
  designCapacity: string // 设计容量
  residualCapacity: string // 剩余容量
  loopCount: string // 循环次数
  updatedTime: string //更新时间
}
export interface batteryAlarmType {
  equilibriumStatus?: AlarmType // 均衡告警状态
  cellOverDischargeStatus?: AlarmType // 电芯过放告警
  voltageOverDischargeStatus?: AlarmType // 总压过放告警
  cellOverVoltageStatus?: AlarmType // 电芯过压告警
  voltageOverVoltageStatus?: AlarmType // 总压过压告警
  dischargeOverCurrentStatus?: AlarmType // 放电过流告警
  chargeOverCurrentStatus?: AlarmType // 充电过流告警
  dischargeOverTemperatureStatus?: AlarmType // 放电过温告警
  chargeOverTemperatureStatus?: AlarmType // 充电过温告警
  environmentLowTemperatureStatus?: AlarmType // 环境低温异常
  environmentHighTemperatureStatus?: AlarmType // 环境高温异常
  batteryTemperatureStatus?: AlarmType // 电池温度告警
  mosTemperatureStatus?: AlarmType // Mos温度告警
  socLowStatus?: AlarmType // SOC 低告警
}
export interface batteryBasicInfoType {
  gpsStarCount: string // gps定位星数
  longtitude: string
  latitude: string
  batteryVersion: string // 硬件版本号
  BatteryLockId: string // 中控号
  gpsSignalTime?: string
  gpsLocateTime?: string
  batteryStatus?: string
  batteryTime?: string
}
export interface queryBatteryInfoResponseData {
  batteryChart: {
    getRealtimeDataset: string[][]
    batteryTemperature: string // 电池温度
    mosTemperature: string // mos温度
    environmentTemperature: string // 环境温度
    maxMonomerVoltage: string //最高单体电压
    minMonomerVoltage: string // 最低单体电压
    voltageDifference: string //单体电压压差
    voltList: string[]
  }
  batteryBasicInfo: batteryBasicInfoType
  batteryAlarm: batteryAlarmType
  batteryHead: batteryHeadType
}
export type queryBatteryInfoResponse = ApiResponseData<queryBatteryInfoResponseData>

export type ChargeDischargeType =
  | 'chargeMosOpen'
  | 'chargeMosShut'
  | 'dischargeMosOpen'
  | 'dischargeMosShut'
export interface ChargeDischargeswitchRequestData {
  produceId: string
  channel: 'Service'
  type: ChargeDischargeType
  productType: string
}
export type ChargeDischargeswitchResponse = ApiResponseData<string>

export interface queryBatteryClassificationProportionRequestData extends TokenRequestData {
  produceId: string
  type: string
}
export interface batteryData {
  batteryNumber: string
  serialNumber: number
  storeName: string
  batteryLockId: string
}
/**
 * 电池详情页分类占比及电池数据
 * @param normalBattery 正常电池
 * @param abnormalBattery 异常电池
 * @param alarmBattery 告警电池
 * @param totalBattery 总电池数
 * @param battery 电池数据
 */
export interface queryBatteryClassificationProportionResponseData {
  normalBattery: number
  abnormalBattery: number
  alarmBattery: number
  totalBattery: number
  battery: batteryData[]
}
export type queryBatteryClassificationProportionResponse =
  ApiResponseData<queryBatteryClassificationProportionResponseData>
